﻿using System;
using System.ComponentModel;
using System.Linq;
using ProjectEuler.Linq;

namespace ProjectEuler.Problems
{
    [EulerProblem(4, 906609L)]
    [Description("Find the largest palindrome made from the product of two 3-digit numbers.")]
    internal sealed class Problem004 : EulerProblem
    {
        public override Object Solve()
        {
            return (from x in Integers.NDigitNumbers(3)
                    from y in Integers.NDigitNumbers(3)
                    let p = x * y
                    where p.IsPalindrome()
                    select p).Max();

        }
    }
}
